import request from '@/utils/request'

// 获取文章列表
export function getArchivesList(params) {
  return request({
    url: '/cms/archives/index',
    method: 'get',
    params
  })
}

// 获取文章详情
export function getArchivesDetail(data) {
  return request({
    url: '/cms/archives/detail',
    method: 'post',
    data
  })
}

// 文章点赞/踩
export function voteArchives(data) {
  return request({
    url: '/cms/archives/vote',
    method: 'post',
    data
  })
}

// 提交文章订单（付费阅读）
export function submitOrder(data) {
  return request({
    url: '/cms/archives/order',
    method: 'post',
    data
  })
}

// 获取栏目
export function getChannel(params) {
  return request({
    url: '/cms/archives/get_channel',
    method: 'get',
    params
  })
}

// 获取栏目字段
export function getChannelFields(params) {
  return request({
    url: '/cms/archives/get_channel_fields',
    method: 'get',
    params
  })
}

// 发布文章
export function postArchives(data) {
  return request({
    url: '/cms/archives/archives_post',
    method: 'post',
    data
  })
}

// 获取我的文章
export function getMyArchives(params) {
  return request({
    url: '/cms/archives/my',
    method: 'get',
    params
  })
}

// 删除文章
export function deleteArchives(data) {
  return request({
    url: '/cms/archives/delete',
    method: 'post',
    data
  })
}